package com.miyake.client.profile;

import java.util.List;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.miyake.client.tools.ClickableLabel;
import com.miyake.client.tools.ImageListElement;
import com.miyake.client.tools.SmallButton;

public class AllUserList extends AbstractUserList {

	@Override
	protected String getListTitle() {
		return "User List";
	}

	@Override
	protected boolean canAdd() {
		return false;
	}

	@Override
	protected int getColumnCount() {
		return 8;
	}

	@Override
	protected void getList() {
		service.getAllUsers(new AsyncCallback<List<ImageListElement>>() {
			@Override
			public void onFailure(Throwable caught) {
				Window.alert(caught.getMessage());
			}

			@Override
			public void onSuccess(List<ImageListElement> result) {
				showList(result, getColumnCount());
			}
		});
	}

	@Override
	protected Widget getCustomVerticalWidget(ImageListElement prop) {
		return new SmallButton("Add");
	}

}
